<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('表格传值给父页面')" />
</head>
<body class="gray-bg">
<div class="container-div">
	<div class="row">
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table"></table>
		</div>
	</div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
	var prefix = ctx + "system/user";
	var datas = [[${@dict.getType('sys_normal_disable')}]];

	$(function() {
		var options = {
			url: prefix + "/list",
			showSearch: false,
			showRefresh: false,
			showToggle: false,
			showColumns: false,
			columns: [{
				radio: true
			},
				{
					field: 'userId',
					title: '主键',
					visible: false
				},
				{
					field: 'userName',
					title: '用户名'
				},
				{
					field: 'dept.deptName',
					title: '部门'
				}]
		};
		$.table.init(options);
	});

	/* 添加用户-选择用户-提交 */
	function submitHandler(index, layero) {
		var rows = $.table.selectFirstColumns();
		if (rows.length == 0) {
			$.modal.alertWarning("请至少选择一条记录");
			return;
		}
		console.log(rows)
		$.modal.close();
		// 父页面的方法
		// parent.selectUsers();
		// 父页面的变量
		parent.$('#userids').html(rows.join());
		parent.$('farmlandId').valueOf(rows.join());
	}
</script>
</body>
</html>
